unit uMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ActnCtrls, Ribbon, ToolWin, ActnMan, ActnMenus, RibbonActnMenus,
  ActnList, RibbonLunaStyleActnCtrls, ComCtrls, JvProgressBar, ExtCtrls,
  ufraRegTreeView, ufraRegListView, StdCtrls, RibbonActnCtrls, CheckLst,
  ufraBookmarks, ufraStatistics, ufraRegHistory, ufraRegInformation, Menus,
  ufraRegMonitor, JvComponentBase, JvShellHook, JvWndProcHook;

type
  TfrmMain = class(TForm)
    StatusBar: TStatusBar;
    PageControl: TPageControl;
    TabSheet1: TTabSheet;
    History: TTabSheet;
    Statistics: TTabSheet;
    pbStatusBar: TProgressBar;
    pnlLeft: TPanel;
    pnlMain: TPanel;
    Splitter: TSplitter;
    fraRegListView: TfraRegListView;
    fraRegTreeView1: TfraRegTreeView;
    actConnectRemote: TAction;
    ActionManager: TActionManager;
    actConnectLocal: TAction;
    actImportRegFile: TAction;
    actExportRegfile: TAction;
    actScripting: TAction;
    actReadOnly: TAction;
    actBackupRegistry: TAction;
    actRestoreRegistry: TAction;
    actMustApplyChanges: TAction;
    actApplyChangesNow: TAction;
    actNewRegfile: TAction;
    Ribbon: TRibbon;
    RibbonPage3: TRibbonPage;
    RibbonGroup10: TRibbonGroup;
    RibbonPage4: TRibbonPage;
    RibbonGroup11: TRibbonGroup;
    CheckListBox1: TCheckListBox;
    RibbonGroup9: TRibbonGroup;
    RibbonGroup13: TRibbonGroup;
    RibbonPage5: TRibbonPage;
    RibbonGroup18: TRibbonGroup;
    RibbonGroup19: TRibbonGroup;
    RibbonGroup20: TRibbonGroup;
    RibbonGroup21: TRibbonGroup;
    RibbonGroup22: TRibbonGroup;
    RibbonPage6: TRibbonPage;
    RibbonGroup23: TRibbonGroup;
    RibbonGroup24: TRibbonGroup;
    RibbonPage7: TRibbonPage;
    RibbonPage2: TRibbonPage;
    RibbonGroup5: TRibbonGroup;
    RibbonGroup6: TRibbonGroup;
    RibbonGroup8: TRibbonGroup;
    RibbonPage1: TRibbonPage;
    RibbonGroup1: TRibbonGroup;
    RibbonGroup2: TRibbonGroup;
    RibbonGroup14: TRibbonGroup;
    RibbonGroup3: TRibbonGroup;
    actNewKey: TAction;
    actNewValue: TAction;
    actDelete: TAction;
    actCut: TAction;
    actCopy: TAction;
    actPaste: TAction;
    actUndo: TAction;
    actSelectAll: TAction;
    actSelectNone: TAction;
    actInvertSelection: TAction;
    Splitter1: TSplitter;
    actFind: TAction;
    actFindNext: TAction;
    actFindAll: TAction;
    actGotoPath: TAction;
    RibbonGroup4: TRibbonGroup;
    actAddBookmark: TAction;
    actHistory: TAction;
    actRegistryBrowser: TAction;
    actKeyBrowser: TAction;
    actCurrentPath: TAction;
    actViewBookmarks: TAction;
    actShowHistory: TAction;
    actShowStatistics: TAction;
    RibbonGroup7: TRibbonGroup;
    RibbonGroup12: TRibbonGroup;
    RibbonGroup15: TRibbonGroup;
    actEdit: TAction;
    actNewFolder: TAction;
    fraRegHistory: TfraRegHistory;
    fraRegStatistics: TfraRegStatistics;
    TabSheet2: TTabSheet;
    fraRegInformation: TfraRegInformation;
    RibbonQuickAccessToolbar1: TRibbonQuickAccessToolbar;
    RibbonApplicationMenuBar1: TRibbonApplicationMenuBar;
    actRegWiki: TAction;
    PageControl1: TPageControl;
    TabSheet3: TTabSheet;
    TabSheet4: TTabSheet;
    fraRegMonitor1: TfraRegMonitor;
    fraBookmarks: TfraBookmarks;
    procedure FormCreate(Sender: TObject);
    procedure StatusBarDrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel;
      const Rect: TRect);
    procedure fraRegTreeView1TreeViewChange(Sender: TObject; Node: TTreeNode);
    procedure actReadOnlyExecute(Sender: TObject);
    procedure actMustApplyChangesExecute(Sender: TObject);
    procedure JvWindowHook1AfterMessage(Sender: TObject; var Msg: TMessage;
      var Handled: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmMain: TfrmMain;

implementation
uses uRegCommon;
{$R *.dfm}

procedure TfrmMain.actMustApplyChangesExecute(Sender: TObject);
begin
self.actMustApplyChanges.Checked := NOT actMustApplyChanges.Checked;
end;

procedure TfrmMain.actReadOnlyExecute(Sender: TObject);
begin
actReadOnly.Checked := NOT actReadOnly.Checked;
Self.fraRegTreeView1.TreeView.ReadOnly := actReadOnly.Checked;
Self.fraRegListView.ListView.ReadOnly := actReadOnly.Checked;
end;

procedure TfrmMain.FormCreate(Sender: TObject);
Var
  ProgressBarStyle : integer;
begin
// enable status bar Last Panel for Custom Drawing
StatusBar.Panels.Items[StatusBar.Panels.Count - 1].Style := psOwnerDraw;

pbStatusBar.Parent := StatusBar;

ProgressBarStyle := GetWindowLong(pbStatusBar.Handle,GWL_EXSTYLE);
ProgressBarStyle := ProgressBarStyle - WS_EX_STATICEDGE;
SetWindowLong(pbStatusBar.Handle,GWL_EXSTYLE,ProgressBarStyle);


if uRegCommon.IsWow64 then
   Begin
   ShowMessage('64bit version of Windows detected. This program is 32bit and may have issues accessing certain portions of the Windows registry.');
   End;

end;

procedure TfrmMain.fraRegTreeView1TreeViewChange(Sender: TObject;
  Node: TTreeNode);
begin
fraRegListView.StatusBar.Panels.Items[0].Text := fraRegTreeView1.TreeView.CurrentPath;
//fraRegListView.StatusBar.SimpleText := fraRegTreeView1.TreeView.CurrentPath;
end;

procedure TfrmMain.JvWindowHook1AfterMessage(Sender: TObject; var Msg: TMessage;
  var Handled: Boolean);
begin
Caption := IntToStr(Msg.Msg);
end;

procedure TfrmMain.StatusBarDrawPanel(StatusBar: TStatusBar;
  Panel: TStatusPanel; const Rect: TRect);
begin
if Panel = StatusBar.Panels.Items[StatusBar.Panels.Count - 1] then
   with pbStatusBar do Begin
     Top := Rect.Top;
     Left := Rect.Left;
     Width := Rect.Right - Rect.Left - 15;
     Height := Rect.Bottom - Rect.Top;
   End;

end;

end.
